<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:set var="ctx" value="${pageContext.request.contextPath}/"/>
<!--[if IE 8]> <head lang="zh-cmn-Hans" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <head lang="zh-cmn-Hans" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<meta charset="utf-8">
<title>高考服务在线系统</title>
<base href="${ctx}">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="Bookmark" href="${ctx}assets/favicon.ico" >
<link rel="Shortcut Icon" href="${ctx}assets/favicon.ico" />
<link rel="shortcut icon" href="${ctx}assets/favicon.ico" />
<link rel="stylesheet" href="${ctx}assets/layer/latest/css/layui.css" media="all" /> 
<script src="${ctx}assets/js/jquery.min.js"></script>
<script src="${ctx}assets/layer/latest/layui.js"></script>
<script src="${ctx}assets/layer/latest/lay/layer/2.1/layer.js"></script> 
<script src="${ctx}assets/admin/js/regxutils.js"></script>
<!--[if lt IE 9]>
<script type="text/javascript" src="${ctx}assets/plugins/html5.js"></script>
<script type="text/javascript" src="${ctx}assets/plugins/respond.min.js"></script>
<script type="text/javascript" src="${ctx}assets/plugins/PIE/PIE_IE678.js"></script>
<![endif]-->

<!--[if IE 6]>
<script type="text/javascript" src="${ctx}assets/plugins/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
 
<script type="text/javascript">          
	
var basePath = "${ctx}";
var ctx = "${ctx}";
var ctxLess=ctx.substring(0,(ctx.length-1));
var debug = false;
(function(){  
	   if(!window.debugs){  
	    window.debugs = function(message){  
	      try{  
	           if(!window.console){  
	               window.console = {};  
	               window.console.log = function(){  
	                  return;  
	               }  
	           }  
	           console.log(message);  
	      }catch(e){}  
	    }; 
	   }
	}  
)();  
/*弹出层*/
/*
	参数解释：
	title	标题
	url		请求的url
	id		需要操作的数据id
	w		弹出层宽度（缺省调默认值）
	h		弹出层高度（缺省调默认值）
*/
function layer_show(title,url,w,h){
	if (title == null || title == '') {
		title=false;
	};
	if (url == null || url == '') {
		url="404.html";
	};
	if (w == null || w == '') {
		w=800;
	};
	if (h == null || h == '') {
		h=($(window).height() - 50);
	};
	debugs("ready to open page: "+url);
	layer.open({
		type: 2,
		area: [w+'px', h +'px'],
		fix: false, //不固定
		maxmin: false,
		shade:0.4,
		title: title,
		content: url
	});
}

/**全屏打开弹出窗*/
function layerfull(title,url){
	debugs("layerOpen:"+title+","+url);
	var index = layer.open({ type: 2, title: title, content: url  });
	layer.full(index);
}

/**
 * 窗口大小可以调整
 */
function layer_resize_show(title,url,w,h){
	if (title == null || title == '') {
		title=false;
	};
	if (url == null || url == '') {
		url="404.html";
	};
	if (w == null || w == '') {
		w=800;
	};
	if (h == null || h == '') {
		h=($(window).height() - 50);
	};
	debugs("ready to open page: "+url);
	layer.open({
		type: 2,
		area: [w+'px', h +'px'],
		fix: false, //不固定
		maxmin: true,
		shade:0.4,
		title: title,
		content: url
	});
}

/**
 * 弹出大小可以调整的窗口
 */
function popresizewin(title, url, w, h){
	layer_resize_show(title, url, w, h);
}
function popwindow(title, url, w, h) {
	layer_show(title, url, w, h); 
}

function popwindow64(title, url) {
	layer_show(title, url, 550,403); 
}

/*关闭弹出框口*/
function layer_close(){
	var index = parent.layer.getFrameIndex(window.name);
	parent.layer.close(index);
}

/**
 * 弹出错误信息
 */
function alertError(webMessage){
	layer.alert(webMessage, {title : ['<fmt:message key="sys.error"/>' , true],  icon: 2, skin: 'layer-ext-moon'  })  ; 
}

/**
 * 弹出OK信息
 */
function alertOk(webMessage){
	layer.alert(webMessage, {title : ['<fmt:message key="sys.message"/>' , true],  icon: 1, skin: 'layer-ext-moon'  })  ; 
}

/**序列化表格 */
$.fn.serializeObject = function(){
   var o = {};    
   var a = this.serializeArray();    
   $.each(a, function() {    
       if (o[this.name]) {    
           if (!o[this.name].push) {    
               o[this.name] = [o[this.name]];    
           }    
           o[this.name].push(this.value || '');    
       } else {    
           o[this.name] = this.value || '';    
       }    
   });    
   return o;    
};  

/**设置全局的ajax配置信息*/
$.ajaxSetup({
	async : false,
	global:false,//布尔值，规定是否为请求触发全局 AJAX 事件处理程序。默认是 true。
	type: "POST",//规定请求的类型（GET 或 POST）。
	timeout: 3000,// 	设置本地的请求超时时间（以毫秒计）。
	headers : {
		'Accept' : 'application/json; charset=UTF-8',
		'Content-Type' : 'application/json; charset=UTF-8'
	},
	dataType : "json", // 	预期的服务器响应的数据类型。
	contentType: "application/json; charset=UTF-8",
	//contentType : 'application/json',//默认是："application/x-www-form-urlencoded"。  application/json;charset=UTF-8
	error:function(xhr){
		alertError("<fmt:message key='sys.errorMessage'/>: " + xhr.status + "<fmt:message key='Check.server.status'/>！" );//请求失败遇到异常触发+ xhr.statusText
	},
	complete: function (xhr, status) { 
		debugs('complete ajax! status:' + status+''); //完成请求后触发。即在success或error触发后触发
	},beforeSend: function (xhr) {
		debugs('beforeSend ajax ...');//发送请求前触发
	}
})

/**处理后台返回的WebStatusMessage*/
function dealwithMsg(webStatus,webMessage){
	if(debug){
		debugs("webStatus:"+webStatus+"   webMessage:"+webMessage);
	}
	if(empty(webStatus)){
		return ;
	}
	
	//{"showDuration": "0", "hideDuration": "0","timeOut": "0","extendedTimeOut": "0"}
	if(webStatus == 500) {
		if(empty(webMessage)) {
			alertError("<fmt:message key='Unknown.error.system'/>");
		}else{ 
			alertError(webMessage); 
		}
	}else if(webStatus == 200) {
		if(empty(webMessage)) {
			alertOk("<fmt:message key='Operation.is.successful'/>"); 
		}else{
			//当需要在成功后关闭父窗口并弹出提示时
			if($("#updateOK").val()=="1"){
				var index = parent.layer.getFrameIndex(window.name);
				parent.listFormPageSearch(1);
				parent.parent.layer.alert(webMessage);
				parent.layer.close(index);
				
			}else{
				alertOk(webMessage); 
			}
			
		}
	}
}

/**检查是否为空*/
function  isEmpty(str){
	return empty(str);
}

/**检查是否为空*/ 
function empty( val ) {
    // test results
    //---------------
    // []        true, empty array
    // {}        true, empty object
    // null      true
    // undefined true
    // ""        true, empty string
    // ''        true, empty string
    // 0         false, number
    // true      false, boolean
    // false     false, boolean
    // Date      false
    // function  false
   if (val === undefined)
        return true;

    if (typeof (val) == 'function' || typeof (val) == 'number' || typeof (val) == 'boolean' || Object.prototype.toString.call(val) === '[object Date]')
        return false;

    if (val == null || val.length === 0 || val === "" || val === " ")        // null or 0 length array
        return true;

    if (typeof (val) == "object") {
        // empty object

        var r = true;

        for (var f in val)
            r = false;

        return r;
    }
    return false;
}
/**
 * 简易的弹出对话框
 */
function dialog(options){
	var img="iVBORw0KGgoAAAANSUhEUgAAADAAAAAgCAYAAABU1PscAAAAiUlEQVR42u2YSwqAMAwFeytv5g09l+LOhZ/a92wamQE3hYYMTeVpKQBgZZqXdX9q14cVODZ7tpZGQmk+VNrVfJiE0oDrBENG6GpvdQ21QPgldgmkfY0CAMA/8ryaR8LyDAIPtbsIKA3ciSv7X6XRLwQckbrbCThGp3l0RxFojuDOD5p0fyMAErIB7kio3inCu1EAAAAASUVORK5CYII=";
	var defaults = {title:'title',width:null,height:null,bakcground:'#FFF',div:$(""),minWidth:'300px',minHeight:'200px'};
	var m_width=$("body").width();
	var opts = $.extend(defaults, options);
	if(m_width<800){
		opts.width=(m_width-30)+'px';
	}
	var div="<div class=\"mz_layer\">"
				+"<div style=\"position:fixed;width:100%;height:100%;left:0px;top:0px;z-index: 1000;background: rgba(0, 0, 0, 0.6);\">"
				+"</div>"
				+"<div class=\"mz_dlalog\" style=\"background-color:#fff;position:fixed;z-index:1001;border:solid #999 1px;left:50%;-webkit-transform: 									translate(-50%, -50%);transform: translate(-50%, -50%);top:50%;padding:0px;border-radius:5px;\">"
					+"<div class=\"mz_head\" style=\"padding-bottom:0px;text-align:center;border-bottom:solid #999 1px;\">"
						+"<span>"+opts.title+"</span>"
						+"<span class=\"mz_close\" style=\"float: right;padding:8px;cursor:pointer;border:#fff 1px solid\"></span>"
					+"</div>"
					+"<div class=\"mz_context\" style=\"padding:0px;text-align:center;\">"
					+"</div>"
				+"</div>"
			+"<div>";
			
	var $mz_layer=$(div);
	$mz_layer.find(".mz_dlalog").css("background-color",opts.bakcground);
	var $mz_close=$mz_layer.find(".mz_close");
	var $mz_context=$mz_layer.find(".mz_context");
	if(opts.width){
		$mz_context.css("width",opts.width);
	}
	if(opts.height){
		$mz_context.css("height",opts.height);
	}
	$mz_context.css("min-width",opts.minWidth);
	$mz_context.css("min-height",opts.minHeight);
	
	$mz_context.empty();
	opts.div.fadeIn();
	$mz_context.append(opts.div);
	$("body").append($mz_layer);

	$mz_close.css("background","url(data:image/png;base64,"+img+") no-repeat -16px 0px");
	$mz_close.hover(function(){
			$(this).css("border","#666 1px solid");
		},function(){
			$(this).css("border","#fff 1px solid");
		});
	$mz_close.click(function(){
		$mz_layer.remove();
	});
	return $mz_context;
}
/**检查是否不为空*/
function  isNotEmpty(str){
	return !isEmpty(str);
}
</script>
<style>
.must,.error{color: red; }
.small{font-size: 10px;}
</style>
